<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<%@ page contentType="text/html; charset=utf-8"%>
	<%@ include file="/commons/taglibs.jsp"%>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>用户管理</title>

		<%@ include file="/commons/css_js_head.jsp"%>


		<script type="text/javascript">
//复写Url
doListUrl = "${ctx }/permission/efUserAction!doList.ts";
doAddBeforeUrl = "${ctx }/permission/efUserAction!doFindById.ts";
doUpdateBeforeUrl = "${ctx }/permission/efUserAction!doFindById.ts";
doDelUrl = "${ctx }/permission/efUserAction!doDelete.ts"

//添加之前
function doAddBefore() {
	var _form = document.forms[0];
	if (doAddBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}

	_form.action = doAddBeforeUrl;
	_form.submit();
}

//更新之前 
function doUpdateBefore(pkId) {
	var _form = document.forms[0];
	if (doUpdateBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}

	_form.action = doUpdateBeforeUrl + "?userId=" + pkId;
	_form.submit();
}

//删除
function doDel(pkId) {
	var _form = document.forms[0];
	if (doDelUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	
	if(confirm("你确定删除当前用户吗？\n删除该用户时，与该用户对应的权限也将随之删除")){
   		_form.action = doDelUrl + "?userId=" + pkId;
		_form.submit();
   }
}
</script>


	</head>
	<body style="overflow-x: hidden">

		<!-- 标题 -->
		<div class="mTitle">
			<span class="hidsearch"><a href="javascript:void(0)"
				onClick="return chg('searchList');" id="ImgArrow"> <img
						src="${ctx}/images/icon_up.gif" id="imgButton" />
			</a> </span>
			<b class="bbig">用户管理</b>
			<a href="javascript:void(0)" onclick="javascript:doAddBefore();" >增加用户</a>
		</div>

		<!--list -->
		<div class="searchBar" id="searchList" style="display: block;">
			<form action="/permission/efUserAction!doFindByTerm" method="post">
				<table class="searchTable">
					<tr>
						<th>
							用户名称：
						</th>
						<td>
							<s:textfield name="userName" theme="simple"></s:textfield>
						</td>
						<th>
							用户账号：
						</th>
						<td>
							<s:textfield name="userAccount" theme="simple"></s:textfield>
						</td>
						<th>
							职位：
						</th>
						<td>
							<select name="dicUserPosition">
								<ef:option groupname="DicUserPosition" selectedValue="${dicUserPosition}" flag="true" link="true"></ef:option>
							</select>
						</td>
						<th>
							用户状态：
						</th>
						<td>
							<select name="dicUserIsValid">
								<ef:option groupname="DicUserIsValid" selectedValue="${dicUserIsValid}" flag="true" link="true"></ef:option>
							</select>
						</td>
						<td>
							<input name="btn_query" type="button" class="btn" value="查询"
								onclick="doQuery()" />
							<input name="btn_reset" type="button" class="btn" value="清空查询条件"
								onclick="doReset()" />
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div class="mainList">

			<table class="listTable">
				<tr>
					<th>
						公司名称
					</th>
					<th>
						公司编码
					</th>
					<th>
						用户账号
					</th>
					<th>
						负责人
					</th>
					<th>
						性别
					</th>
					<th>
						手机号
					</th>
					
					<th>
						用户状态
					</th>
					<th>
						备注
					</th>
					<th>
						操作
					</th>
				</tr>

				<c:forEach var="user" items="${voList}">
					<tr align=center>
						<td>
							${user.compName}
						</td>
						<td>
							${user.compCode}
						</td>
						<td>
							${user.userAccount}
						</td>
						<td>
							${user.userName}
						</td>
						<td>
							<ef:CodeToName groupname="DicSex"
								translateValue="${user.dicUserSex}"></ef:CodeToName>
						</td>
						<td>
							${user.userMobile}
						</td>
						<td>
							<c:if test="${user.dicUserIsValid==1}">
								<span class="icon_yes">&nbsp;</span>
							</c:if>
							<c:if test="${user.dicUserIsValid==0}">
								<span class="icon_no">&nbsp;</span>
							</c:if>
							<ef:CodeToName groupname="DicUserIsValid"
								translateValue="${user.dicUserIsValid}"></ef:CodeToName>
						</td>
						<td>
							${user.validReason}
						</td>
						<td>
							<a href="javascript:void(0)"
								onclick="javascript:doUpdateBefore('${user.userId}');"><span
								class="icon_edit">&nbsp;</span>修改</a>
							<a href="javascript:void(0)" onclick="javascript:doDel('${user.userId}');"><span
								class="icon_del">&nbsp;</span>删除</a>
						</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		<!--end list -->

		<div class="Toolbar">

		</div>

	</body>
</html>
